package com.lzm.back.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Data;

import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import java.time.LocalDateTime;

@Data
public class User {

    private Integer id;
    private String username;
    private String password;

    @Enumerated(EnumType.STRING) // 确保按字符串存储枚举
    private Role role;
    private String email;
    private String phone;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    @JsonCreator
    public static Role forValue(String value) {
        return Role.valueOf(value.toUpperCase());
    }
}
